<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<include file="Public:meta" />
	<style>
		#InfoHit{	color:#00F;	font-weight:bold;}
		label{	color:#00F; line-height:21px; 	font-weight:bold; height:21px; vertical-align:middle;	font-size:12px;}
		.WINNT{ color:black; font-weight:bold;}
		.Linux{ color: #00F; font-weight:bold;}
	</style>
</head>
<body id="main_page">
<include file="Public:position" />
<div class="container"> 
   <form enctype="multipart/form-data"  method="post" id="frm">
            <input type="hidden" name="NowPage" id="NowPage" value="{$NowPage}" />
            <div class="table">
                <div class="toolbars">
                    <li class="toolbar"><a id="btnSaveAll" href="{$Url}add"  title="添加授权信息" target="_self">添加授权信息</a></li>
                    <li class="toolbar"><a id="selectall" onclick="CheckAll()"  title="全选">全选</a></li>
                    <li class="toolbar"><a id="btnCheck" onclick="BatchAuthorize(1)" title="授权">授权</a></li>
                    <li class="toolbar"><a id="btnUnCheck" onclick="BatchAuthorize(0)" title="取消授权">取消授权</a></li>
                    <li class="toolbar toolbarform" id="toolbarleft">&nbsp;&nbsp;
                        域名总数：<b style="color:red">{$Total}</b>&nbsp;&nbsp;
                        未授权：<b style="color:red">{$UnAuthorizeCount}</b>&nbsp;&nbsp;
                        已授权：<b style="color:red">{$AuthorizeCount}</b>&nbsp;&nbsp;
                        正版用户比率：<b style="color:red">{$Percent}%</b>&nbsp;&nbsp;
                        操作系统统计：<volist name="Stat" id="s">{$s.OS}：<b style="color:red">{$s.Percent}%</b>&nbsp;&nbsp;</volist>
                    </li>
                    <li class="toolbar toolbarform" style="margin-bottom:5px;">
                        <label>域名</label><input type="text" class='textinput' name="Host" style="width:150px" value="{$Host}" id="Host"/>
                        <label>是否授权</label><select name="IsAuthorize" id="IsAuthorize">
                        <option value="-1">全部</option>
                        <option value="1">已授权</option>
                        <option value="0">未授权</option>
                        </select>
                        
                        <label>所属代理</label>
                        <select name="AgentID">
                            <option value="-1" selected="selected">全部</option>
                            <volist name="AgentData" id="a">
                                <option value="{$a.MemberID}" <eq name="a.MemberID" value="$AgentID">selected="selected"</eq> >
                                    {$a.MemberID}&nbsp;&nbsp;{$a.MemberName}&nbsp;&nbsp;{$a.MemberRealName}
                                    <neq name="a.MemberGroupID" value="101">&nbsp;&nbsp;{$a.MemberGroupName}</neq>
                                </option>
                            </volist>
                        </select>
                        
                        <label>操作员</label>
                        <select name="OperatorID">
                            <option value="-1" selected="selected">全部操作员</option>
                            <volist name="OperatorData" id="a">
                                <option value="{$a.MemberID}" <eq name="a.MemberID" value="$OperatorID">selected="selected"</eq> >
                                    {$a.MemberID}&nbsp;&nbsp;{$a.MemberRealName}
                                </option>
                            </volist>
                        </select>
                        <input id="btnSeek" class="btnToolbarForm" type="submit" value="查询" onclick="Search()" >
                    </li>
                </div>
               
                <table class="datatable" id="datatable">
                    <tr>
                        <th width="35px"  nowrap="nowrap">选中</th>
                        <th width="55px" nowrap="nowrap">ID</th>
                        <th width="120px" >所属客户</th>
                        <th width="200px">域名</th>
                        <th width="55px" >版本号</th>
                        <th width="60px" >操作系统</th>
                
                        <th width="65px" nowrap="nowrap">是否授权</th>
                        <th width="120px" nowrap="nowrap">时间</th>
                        <th width="75px" nowrap="nowrap">操作员</th>
                        <th>备注</th>
                        <th width="230px" >操作</th>
                    </tr>  
                    <notempty name="Data">                
                        <volist name="Data" id="i">
                            <tr>
                                <td><input class="checkrow" type="checkbox" name="AuthorizeID[]" value="{$i.AuthorizeID}" /></td>
                                <td>{$i.AuthorizeID}</td>
                                <td><notempty name="i.CustomerID">{$i.CustomerName}&nbsp;[{$i.CustomerID}]&nbsp;</notempty>
                                <notempty name="i.OEM"><br/><span style="color:blue;">{$i.OEM}</span></notempty></td>
                                <td><a href="http://{$i.Host}" target="_blank">{$i.Host}</a></td>
                                <td>{$i.Version}</td>
                                <td><span  class="{$i.OS}">{$i.OS}</span></td>
                                
                                <td><eq name="i.IsAuthorize" value="1"><span style="color:#000">已授权<else/><span style="color:#F00">未授权</eq></span></td>
                                <td>{$i.AuthorizeTime|strtotime|yd_friend_date}</td>
                                <td style="color:#090;">{$i.OperatorName}</td>
                                <td style="text-align:left;">{$i.Remark}</td>
                                
                                <td class="operator">
                                    <a style="float:left" href="{$Url}Modify/AuthorizeID/{$i.AuthorizeID}" id="btnEdit">修改</a>
                                    <div class="btn-sep"></div>
                                    <eq name="i.IsAuthorize" value="0">
                                        <a style="float:left"  onclick="Del({$i.AuthorizeID})" class="btnDel">删除</a>
                                        <div class="btn-sep"></div>
                                        <a style="float:left" onclick="Authorize(1, {$i.AuthorizeID})" id="btnCheck">授权</a>
                                    <else/>
                                        <a style="float:left" onclick="Authorize(0, {$i.AuthorizeID})" id="btnUnCheck">取消授权</a>
                                    </eq>
                                </td>
                            </tr>
                        </volist>
                    <else/>
                        <tr><td colspan="12" id="NoData">{$Think.lang.NoDataTip}</td></tr>
                    </notempty>                                
                </table>
                 <div class="tfoot">
                      <div class="page"><span class="pagesize">每页<span class="pz">{$AdminPageSize}</span>条</span>{$Page}</div>
                 </div>
         </div>
    </form>
</div>
</body>
</html>
<script type="text/javascript">
//查询
function Search(){
	$('#frm').attr("action", "__URL__/index");
	$('#frm').submit();
	return true;
}

function Authorize(value, id){
	if( value == 1 ){
		if( !confirm("确定授权吗?") ) return false;
		$('#frm').attr("action", "{$Url}authorize/Authorize/1/AuthorizeID/"+id);
	}else{
		if( !confirm("确定取消授权吗?") ) return false;
		$('#frm').attr("action", "{$Url}authorize/Authorize/0/AuthorizeID/"+id);
	}
	$('#frm').submit();
	return true;
}

//批量审核
function BatchAuthorize(bCheck){
	//先必须选中记录==============================================
	var arrChk = $("input[name='AuthorizeID[]']");
	var n = 0;
	for(var i = 0; i < arrChk.length; i++){
		if(arrChk[i].checked) n++;
	}
	if( n == 0 ) {
		WarnBox("请先选中记录!");
		return;
	}
	//=========================================================
	if( bCheck == 1 ){
		if( !confirm("确定授权吗?") ) return false;
		$('#frm').attr("action", "{$Url}authorize/Authorize/1");
	}else{
		if( !confirm("确定取消授权吗?") ) return false;
		$('#frm').attr("action", "{$Url}authorize/Authorize/0");
	}
	
	$('#frm').submit();
	return true;
}

function Del(id){
	$.confirm("{$Think.lang.DeleteTip}", function () {
		$('#frm').attr("action", "{$Url}Del/AuthorizeID/"+id);
		$('#frm').submit();
	}, function () {
		return true;
	});
}

//提示信息
$(document).ready(function(){
	//选中操作
	$("#Host").attr("value",'{$Host}');
	$("#IsAuthorize").attr("value",'{$IsAuthorize}');
});
</script>